package com.stu.entity.permission;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.stu.entity.base.BaseEntity;

@Entity
@Table(name = "USER")
public class User extends BaseEntity{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	//账号密码
	private String account;
	private String pwd;
	private String email;
	private String phone;
	
	//适应 多说
	private String duoshuoid;//用户多说id
	private String nickname;
	private String avatar_url;//头像
	private String url;//首页

	// 适应 三方登录
	private String code;//三方登录码
	
	//适应前台验证码
	private String verifyCode;
	
	@Column(name="account",unique=true,length=30)
	public String getAccount() {
		return account;
	}
	@Column(name="pwd",length=36)
	public String getPwd() {
		return pwd;
	}
	@Column(name="duoshuoid",length=36)
	public String getDuoshuoid() {
		return duoshuoid;
	}
	@Column(name="nickname",length=30)
	public String getNickname() {
		return nickname;
	}
	@Column(name="avatar_url",length=200)
	public String getAvatar_url() {
		return avatar_url;
	}
	@Column(name="url",length=200)
	public String getUrl() {
		return url;
	}
	@Column(name="verifyCode",length=20)
	public String getVerifyCode() {
		return verifyCode;
	}
	@Column(name="email",length=20)
	public String getEmail() {
		return email;
	}
	@Column(name="phone",length=20)
	public String getPhone() {
		return phone;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	
	public void setDuoshuoid(String duoshuoid) {
		this.duoshuoid = duoshuoid;
	}
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public void setAvatar_url(String avatar_url) {
		this.avatar_url = avatar_url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public void setVerifyCode(String verifyCode) {
		this.verifyCode = verifyCode;
	}

	
	/**
	 * 判断某个用户是不是超级管理员
	 *  超级管理员的 id 是 admin
	 * @author lijian
	 *
	 * @return
	 */
	public static boolean isAdmin(User user){
		boolean flag=false;
		if(user.getUuid().equals("admin")){
			flag=true;
		}
		return flag;
	}
	
	public User() {
		super();
	}
	public User(String uuid) {
		super(uuid);
	}
	/**
	 * 这里是为了hql 只查询用户名和密码
	 * @param account
	 * @param pwd
	 */
	public User(String account, String pwd) {
		super();
		this.account = account;
		this.pwd = pwd;
	}
	@Override
	public String toString() {
		return "User [account=" + account + ", pwd=" + pwd + ", email=" + email + ", phone=" + phone + ", nickname="
				+ nickname + ", avatar_url=" + avatar_url + ", url=" + url + ", code=" + code + ", verifyCode="
				+ verifyCode + "]";
	}
	
	
	
	
}
